package jdbc;

import java.util.Arrays;
import java.util.List;

/**
 * SQL command.
 * <pre>
 *     sql statement
 *     sql parameters
 * </pre>
 */
public class Command {
    private String sql;
    private List<Object> params;

    public static Command build() {
        return new Command();
    }

    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public Command sql(String sql) {
        this.sql = sql;
        return this;
    }

    public List<Object> getParams() {
        return params;
    }

    public void setParams(List<Object> params) {
        this.params = params;
    }

    public Command params(Object... params) {
        this.params = Arrays.asList(params);
        return this;
    }

    @Override
    public String toString() {
        return "Command{" +
                "sql='" + sql + '\'' +
                ", params=" + params +
                '}';
    }
}